package main

import (
	"fmt"
	"math/rand"
)

/*
需求：
1. 创建一个person结构体[Name, Age, Address]
2. 使用rand方法配合随机数创建10个Person实例，并放到channel中
3. 遍历channel，将各个Person实例显示在终端
 */
type person struct {
	name string
	age int
	address string
}

func main() {
	var chanM chan person
	chanM = make(chan person, 10)
	for i:=1; i<=10; i++ {
		per := person{
			name:    "xyt",
			age:     rand.Intn(30),
			address: "china",
		}
		chanM <- per
	}
	switch <- chanM {



	}
	close(chanM)

	for  v := range chanM{
		fmt.Println(v)

	}



}
